package com.tongandtang.bg.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tongandtang.bg.entity.Perm;
import com.tongandtang.bg.entity.User;
import com.tongandtang.bg.mapper.UserMapper;
import com.tongandtang.bg.service.IUserService;
import com.alibaba.dubbo.config.annotation.Service;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Tong
 * @since 2019-12-16
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService{

    @Override
    public List<Perm> getUserPerms(Long userId) {
        return baseMapper.getUserPerms(userId);
    }

    @Override
    public User getUserByPhone(String phone) {
        QueryWrapper<User> query=new QueryWrapper<>();
        query.eq("phone",phone);
        return baseMapper.selectOne(query);
    }

    @Override
    public User getUserByEmail(String email) {
        QueryWrapper<User> query=new QueryWrapper<>();
        query.eq("email",email);
        return baseMapper.selectOne(query);
    }
}
